package cate.common.table.activity.herotrial;

import cate.common.table.ERow;
import cate.common.table.XSSFRowWrap;
import cp.solution.util.str.Str;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;

@NoteClass("关卡")
public class HeroTrialLevelRow extends ERow {

    @NoteField("关卡分组ID")
    public int levelGroup;

    @NoteField("关卡ID")
    public int levelTid;

    @NoteField("开启天数")
    public int openDay;

    @NoteField("难度")
    public int difficulty;

    @NoteField("怪物配置")
    public String monsterCode;

    @NoteField("备选英雄分组")
    public int heroGroup;

    @NoteField("英雄等级")
    public int heroLevel;

    @NoteField("必上英雄")
    private String forceHeroStr;

    @NoteField("免费礼包")
    public String freeRwdStr;

    @NoteField("付费礼包")
    public String payRwdStr;

    @NoteField("付费礼包消耗")
    public String payCostStr;

    @Override
    public void parse(XSSFRowWrap xrw) {
        super.parse(xrw);
        this.id = xrw.getInteger("ID", 0);
        this.levelGroup = xrw.getInteger("关卡分组ID",0);
        this.levelTid = xrw.getInteger("关卡ID",0);
        this.openDay = xrw.getInteger("开启天数", 0);
        this.difficulty = xrw.getInteger("关卡难度",0);
        this.monsterCode = xrw.getString("怪物配置");
        this.heroGroup = xrw.getInteger("备选英雄分组",0);
        this.heroLevel = xrw.getInteger("英雄等级", 1);
        this.forceHeroStr = xrw.getString("必上英雄");
        this.freeRwdStr = xrw.getString("免费礼包");
        this.payRwdStr = xrw.getString("付费礼包");
        this.payCostStr = xrw.getString("付费礼包消耗");
    }


    public List<Integer> forceHeroList = new ArrayList<>();

    @Override
    public void decode() {
        if (StringUtils.isNotBlank(forceHeroStr)) {
            forceHeroList = Str.strArr2intList(forceHeroStr.split("#"));
        }
    }
}
